Log in Register Dashboard Temp Share Shortlinks Frames API

cody - HTMLify profile

cody's Profile Picture

cody

4270 Files

634216 Views

Latest files of /cody/swapnilsparsh/30DaysOfJavaScript/36 - Hangman/scripts

app.js cody/swapnilsparsh/30DaysOfJavaScript/36 - Hangman/scripts/app.js
164 Views
0 Comments
let game1
const puzzleDIV = document.querySelector('#puzzle');
const remainingDIV = document.querySelector('#guesses');

window.addEventListener('keypress', (e) => {

const guess = String.fromCharCode(e.charCode);
game1.makeGuess(guess);
request.js cody/swapnilsparsh/30DaysOfJavaScript/36 - Hangman/scripts/request.js
156 Views
0 Comments
const getPuzzle = async (wordCount) => {
const response = await fetch(`https://puzzle.mead.io/puzzle?wordCount=${wordCount}`)
if (response.status === 200){
const data = await response.json()
return data.puzzle
} else {
throw new Error('Unable to fetch puzzle')
}
hangman.js cody/swapnilsparsh/30DaysOfJavaScript/36 - Hangman/scripts/hangman.js
161 Views
0 Comments
class Hangman {
constructor(word, remainingGuesses){
this.word = word.toLowerCase().split('');
this.remainingGuesses = remainingGuesses;
this.guessedLetters = [];
this.status = 'playing';
}